#find all the relevant files
people <- list.files("./faces")
pictures <- list.files(paste("./faces/",people,sep=""),full.name=TRUE)
desiredSubset <- grep(value=TRUE,"4.pgm",pictures)

#seperate training and testing data
percentTrain <- 0.8 #TODO hardcoded, should be softer maybe?
sampleCount <- floor(percentTrain*length(desiredSubset))
TrainIndices <- sample(1:length(desiredSubset),sampleCount)

TestIndices <- c() #TODO: this is super hacky and should die in a fire
i <- 1
for(k in 1:length(desiredSubset)) {
  if(k %in% TrainIndices) {
    
  } else {
    TestIndices[i] <- k
    i <- i + 1
  }
}


TrainingData <- desiredSubset[TrainIndices]
TestData <- desiredSubset[TestIndices]
